package com.inventory.persistence;

import org.springframework.context.ApplicationContext;
import org.springframework.web.context.ContextLoader;

public class SpringBeanFactory {

	private static ApplicationContext ctx = ContextLoader
			.getCurrentWebApplicationContext().getParent();

	public static Object getBean(String beanName) {
		return ctx.getBean(beanName);
	}

	public static <T> T getBean(Class<T> beanClass) {
		return (T) ctx.getBean(beanClass);
	}

}
